<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>${functionName}管理</title>
<%@include file="/WEB-INF/views/include/head.jsp" %>
<%@include file="/WEB-INF/views/include/treeview.jsp" %>
</head>
<body class="easyui-layout">
	<div id="${className}ToolBar">
		<#if formHead.existSearchForm>
		<div class="searchBar">
			<form id="${className}SearchForm">
			<#list formFieldList as po>
			<#if po.querySign == 'true'>
			<#if po.fieldJavaType == 'Date'>
			<span class="block">
        		<span class="label" title="${po.fieldContent}起">${po.fieldContent}起：</span>
    			<input type="text" name="${po.fieldNameLC}Start" readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"/>
        	</span>
        	<span class="block">
        		<span class="label" title="${po.fieldContent}止">${po.fieldContent}止：</span>
    			<input type="text" name="${po.fieldNameLC}End" readonly="readonly" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"/>
        	</span>
			<#else>
			<span class="block">
        		<span class="label" title="${po.fieldContent}">${po.fieldContent}：</span>
        		<input type="text" name="${po.fieldNameLC}"/>
        	</span>
        	</#if>
			</#if>
			</#list>
			&nbsp;&nbsp;&nbsp;&nbsp;
	    	<a href="javascript:$.fr.searchForm({tableId:'${className}Table',formId:'${className}SearchForm'});" class="easyui-linkbutton" iconCls="icon-search" style="width:80px">查询</a>
			</form>
		</div>
		<div class="searchBarLine"></div>
		</#if>
		<div class="toolBar">
			<a href="javascript:$.fr.addWin({title:'${functionName}',url:'${r"${ctx }"}/${moduleName}/${className}/get.action',tableId:'${className}Table',width:600,height:400 });" class="easyui-linkbutton" iconCls="icon-add" style="width:80px">新增</a>
			<a href="javascript:$.fr.editWin({title:'${functionName}',url:'${r"${ctx }"}/${moduleName}/${className}/get.action',tableId:'${className}Table',width:600,height:400 });" class="easyui-linkbutton" iconCls="icon-edit" style="width:80px">编辑</a>
			<#if formHead.checkboxSign == 'true'>
	       	<a href="javascript:$.fr.deleteBatch({url:'${r"${ctx }"}/${moduleName}/${className}/delete.action',tableId:'${className}Table'},'${functionName}');" class="easyui-linkbutton" iconCls="icon-remove" style="width:80px">批量删除</a>
	       	</#if>
	    </div>
    </div>
	<div data-options="region:'center'" title="${functionName}列表">
		<table id="${className}Table"></table>
	</div>
	<#list formHead.tbFormFieldListFormatter as po>
	 ${r"${frjee:dictFormatter("}"${po.fieldNameLC}Formatter","${po.dictType}")${r"}"}
	</#list>
	<script type="text/javascript">
		function operateFormatter(value,row,index){
			var _html = "[<a href=\"javascript:$.fr.deleteSingle('"+row.id+"',{url:'${r"${ctx }"}/${moduleName}/${className}/delete.action',tableId:'${className}Table'},'${functionName}')\">删除</a>]";
			return _html;
		};
		$('#${className}Table').datagrid({	    
		  	border:false,
		 	rownumbers:true,
		 	singleSelect:true,
		 	checkOnSelect:false,
		 	selectOnCheck:false,
		 	fitColumns:false,
		 	fit: true,
		 	pagination: ${formHead.pageSign},
			toolbar:'#${className}ToolBar',
			url:'${r"${ctx }"}/${moduleName}/${className}/findPage.action',
			method:'post',
			columns:[[
					<#if formHead.checkboxSign == 'true'>
					  {field:'id',title:'id',width:80,checkbox:true}, 
	            	<#else>
	            	  {field:'id',title:'id',width:80,hidden:true}, 
	            	</#if>
	            	<#list formHead.tbFormFieldList as po>
            		<#if po.fieldNameLC != 'id' && po.showListSign == 'true'>
            			<#if po.dataType ??>
            			<#switch po.dataType>
            				<#case "dict">
            		  {field:'${po.fieldNameLC}',title:'${po.fieldContent}',width:80,formatter:${po.fieldNameLC}Formatter},
            					<#break>
            				<#case "dept">
            		  {field:'${po.fieldNameLC}',title:'${po.fieldContent}',width:80},
            					<#break>
            				<#case "user">
            		  {field:'${po.fieldNameLC}',title:'${po.fieldContent}',width:80},	
            					<#break>
            				<#default>
        			  {field:'${po.fieldNameLC}',title:'${po.fieldContent}',width:80},
            			</#switch>
            			<#else>
        			  {field:'${po.fieldNameLC}',title:'${po.fieldContent}',width:80},
            			</#if>
            		</#if>
	            	</#list>
			          {field:'operate',title:'操作',width:80,align:'center',formatter:operateFormatter}  
			      	]]  
	  	}); 
	</script>
</body>
</html>